<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <link rel="stylesheet" href="/sys/resources/css/reset.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="/sys/resources/css/style.css" type="text/css" media="screen"/>
    <link rel="stylesheet" href="/sys/resources/css/invalid.css" type="text/css" media="screen"/>
    <script type="text/javascript" src="/sys/resources/scripts/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="/sys/resources/scripts/simpla.jquery.configuration.js"></script>
    <script type="text/javascript" src="/sys/resources/scripts/facebox.js"></script>
    <title>新增管理员</title>
</HEAD>
<BODY class="mian_bg">
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center border=0>
    <TR height=28>
        <TD class="addr_td">&nbsp;&nbsp;<img src="/sys/resources/images/addr_icon.png">&nbsp;当前位置: 系统设置 > 新增管理员</TD>
    </TR>
    <TR>
        <TD bgColor=#7ca600 height=1></TD>
    </TR>
    <TR>
        <TD bgColor=#8ebe00 height=1></TD>
    </TR>
</TABLE>
<div id="main-content">
    <div class="content-box">
        <!-- Start Content Box -->
        <div class="content-box-header">
            <h3>新增管理员</h3>

            <div class="clear"></div>
        </div>
        <div class="content-box-content">
            <div class="tab-content default-tab" id="tab1">
                <form action="/sys/roleManage/addData.do" method='post' id="form" name="form" onsubmit="deal3();">
                    <table>
                        <tbody>
                        <tr>
                            <td colspan="3"><a href="/sys/roleManage/index.do">【返回列表】</a></td>
                        </tr>
                        <tr>
                            <td>角色名称</td>
                            <td colspan="2"><input type="text" name="rolename" value="${sysRole.name}"/></td>
                        </tr>
                        <tr>
                            <td>状态</td>
                            <td colspan="2">
                                <c:choose>
                                    <c:when test="${sysRole.status eq '1'}">
                                        <label class="radio_label">
                                            <input type="radio" checked value="1" name="status">正常</label>
                                        <label class="radio_label">
                                            <input type="radio" name="status" value="0">屏蔽</label>
                                    </c:when>

                                    <c:when test="${sysRole.status eq '0'}">
                                        <label class="radio_label">
                                            <input type="radio" name="status" value="1">正常</label>
                                        <label class="radio_label">
                                            <input type="radio" checked value="0" name="status">屏蔽</label>
                                    </c:when>
                                    <c:otherwise>
                                        <label class="radio_label">
                                            <input type="radio" checked name="status" value="1">正常</label>
                                        <label class="radio_label">
                                            <input type="radio" value="0" name="status">屏蔽</label>
                                    </c:otherwise>
                                </c:choose>
                            </td>
                        </tr>
                        <tr>
                            <td>权限设置</td>
                            <td colspan="2">
                                1. 如果要指定当前模块下的所有权限，可选中该模块名称 <br>
                                2. 如果要指定当前模块下的操作权限，可选中该模块的操作名称
                            </td>
                        </tr>

                        <tr>
                            <td>导航</td>
                            <td>模块</td>
                            <td>操作</td>
                        </tr>

                        ${nodeList}

                        <tr>
                            <td colspan="3">
                                <input class="button" type="submit" value=" 提交 "/>
                                <input type="hidden" name="roleid" value="${sysRole.roleid}">
                            </td>
                        </tr>
                        </tbody>
                    </table>
                </form>
            </div>
            <!-- End #tab1 -->
        </div>
        <!-- End .content-box-content -->
    </div>
    <!-- End .content-box -->
</div>

<script type="text/javascript">
    function deal3() {
        $("input[name='node']").removeAttr('disabled'); //取消锁定
    }

    function deal(className) {
        if ($("#" + className).attr("checked") == true) {
            $(".nav_" + className + " input").attr('checked', "checked");
            $(".nav_" + className + " input").attr('disabled', "true");
        } else {
            $(".nav_" + className + " [name='node']").removeAttr("checked");//取消全选
            $(".nav_" + className + " input").removeAttr('disabled'); //取消锁定
        }
    }

    function deal2(obj) {
        var parent = $(obj).parent().parent();
        if ($(obj).attr("checked") == true) {
            $("td input", parent).attr('checked', "checked");
            $("td input", parent).attr('disabled', "true");
        } else {
            $("td input", parent).removeAttr('checked');
            $("td input", parent).removeAttr('disabled');
        }
    }

    function deal3() {
        $("input[name='node']").removeAttr('disabled'); //取消锁定
    }

    <c:forEach var="item" items="${sysRoleAccesses}">
    $("#node_" +${item.nodeid}).attr('checked', "checked");
    </c:forEach>
</script>
</BODY>
</HTML>